package MapHomeWork.fourthquestion;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapStudy {
    public static void main(String[] args) {
        Map<Integer,String> map = new HashMap<>();
        map.put(1,"张三丰");
        map.put(2,"周芷若");
        map.put(3,"汪峰");
        map.put(4,"灭绝师太");

        Set<Map.Entry<Integer,String>> set =map.entrySet();
        System.out.println("序号\t人名");
        for (Map.Entry<Integer,String> s: set) {
            System.out.println(s.getKey()+"\t"+s.getValue());
        }

        System.out.println("*******************");
        map.put(5,"李晓红");
        System.out.println("**********************");

        map.remove(1);

        map.remove(2);
        map.put(2,"周林");

        Set<Map.Entry<Integer,String>> set1 =map.entrySet();
        System.out.println("序号\t人名");
        for (Map.Entry<Integer,String> s: set) {
            System.out.println(s.getKey()+"\t"+s.getValue());
        }
    }
}
